function shallowCopy(obj) {
  let obj1 = {}
  for (let key in obj) {
    if (obj.hasOwnProperty(key)) {
      obj1[key] = obj[key]
    }
    if (typeof obj[key] === 'object') {
      obj1[key] = shallowCopy(obj[key])
    }
    if (Array.isArray(obj[key])) {
      obj1[key] = obj[key].slice()
    }
    if (typeof obj[key] === 'function') {
      obj1[key] = obj[key]
    }



  }
  return obj1
}
let obj = {
  a: 1,
  b: 2,
  c: {
    d: 3,
    e: 4
  }
}
let obj1 = shallowCopy(obj)
console.log(obj1)
obj.c.d = 5
console.log(obj)
console.log(obj1)
